<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script type="text/javascript">
        function f(v) {
            var sum=0;
            for (var d=0;d<=v;d++){
                if (d%2==0){
                    sum+=d
                }
            }
            return sum;
        }
        sum1=f(4);
        console.log(sum1)
    </script>
</body>
</html>